/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package TapestryModel.util;

import TapestryModel.Activation;
import TapestryModel.ActivationMapping;
import TapestryModel.Attribute;
import TapestryModel.ContentAttirbute;
import TapestryModel.ContentData;
import TapestryModel.ContentObject;
import TapestryModel.Data;
import TapestryModel.Entity;
import TapestryModel.EntityData;
import TapestryModel.Form;
import TapestryModel.Link;
import TapestryModel.LinkMapping;
import TapestryModel.Page;
import TapestryModel.ParamLink;
import TapestryModel.Reference;
import TapestryModel.SimpleLink;
import TapestryModel.Site;
import TapestryModel.TapestryModelPackage;
import TapestryModel.Value;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see TapestryModel.TapestryModelPackage
 * @generated
 */
public class TapestryModelSwitch<T> {
    /**
     * The cached model package
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected static TapestryModelPackage modelPackage;

    /**
     * Creates an instance of the switch.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public TapestryModelSwitch() {
        if (modelPackage == null) {
            modelPackage = TapestryModelPackage.eINSTANCE;
        }
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    public T doSwitch(EObject theEObject) {
        return doSwitch(theEObject.eClass(), theEObject);
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    protected T doSwitch(EClass theEClass, EObject theEObject) {
        if (theEClass.eContainer() == modelPackage) {
            return doSwitch(theEClass.getClassifierID(), theEObject);
        }
        else {
            List<EClass> eSuperTypes = theEClass.getESuperTypes();
            return
                eSuperTypes.isEmpty() ?
                    defaultCase(theEObject) :
                    doSwitch(eSuperTypes.get(0), theEObject);
        }
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    protected T doSwitch(int classifierID, EObject theEObject) {
        switch (classifierID) {
            case TapestryModelPackage.SITE: {
                Site site = (Site)theEObject;
                T result = caseSite(site);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.PAGE: {
                Page page = (Page)theEObject;
                T result = casePage(page);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.ACTIVATION: {
                Activation activation = (Activation)theEObject;
                T result = caseActivation(activation);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.ACTIVATION_MAPPING: {
                ActivationMapping activationMapping = (ActivationMapping)theEObject;
                T result = caseActivationMapping(activationMapping);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.FORM: {
                Form form = (Form)theEObject;
                T result = caseForm(form);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.LINK: {
                Link link = (Link)theEObject;
                T result = caseLink(link);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.SIMPLE_LINK: {
                SimpleLink simpleLink = (SimpleLink)theEObject;
                T result = caseSimpleLink(simpleLink);
                if (result == null) result = caseLink(simpleLink);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.PARAM_LINK: {
                ParamLink paramLink = (ParamLink)theEObject;
                T result = caseParamLink(paramLink);
                if (result == null) result = caseLink(paramLink);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.LINK_MAPPING: {
                LinkMapping linkMapping = (LinkMapping)theEObject;
                T result = caseLinkMapping(linkMapping);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.OBJECT: {
                TapestryModel.Object object = (TapestryModel.Object)theEObject;
                T result = caseObject(object);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.ENTITY: {
                Entity entity = (Entity)theEObject;
                T result = caseEntity(entity);
                if (result == null) result = caseObject(entity);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.ENUM: {
                TapestryModel.Enum enum_ = (TapestryModel.Enum)theEObject;
                T result = caseEnum(enum_);
                if (result == null) result = caseObject(enum_);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.VALUE: {
                Value value = (Value)theEObject;
                T result = caseValue(value);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.DATA: {
                Data data = (Data)theEObject;
                T result = caseData(data);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.ENTITY_DATA: {
                EntityData entityData = (EntityData)theEObject;
                T result = caseEntityData(entityData);
                if (result == null) result = caseData(entityData);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.CONTENT_DATA: {
                ContentData contentData = (ContentData)theEObject;
                T result = caseContentData(contentData);
                if (result == null) result = caseData(contentData);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.REFERENCE: {
                Reference reference = (Reference)theEObject;
                T result = caseReference(reference);
                if (result == null) result = caseEntityData(reference);
                if (result == null) result = caseData(reference);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.ATTRIBUTE: {
                Attribute attribute = (Attribute)theEObject;
                T result = caseAttribute(attribute);
                if (result == null) result = caseEntityData(attribute);
                if (result == null) result = caseData(attribute);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.CONTENT_OBJECT: {
                ContentObject contentObject = (ContentObject)theEObject;
                T result = caseContentObject(contentObject);
                if (result == null) result = caseContentData(contentObject);
                if (result == null) result = caseData(contentObject);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case TapestryModelPackage.CONTENT_ATTIRBUTE: {
                ContentAttirbute contentAttirbute = (ContentAttirbute)theEObject;
                T result = caseContentAttirbute(contentAttirbute);
                if (result == null) result = caseContentData(contentAttirbute);
                if (result == null) result = caseData(contentAttirbute);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            default: return defaultCase(theEObject);
        }
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Site</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Site</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseSite(Site object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Page</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Page</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T casePage(Page object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Activation</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Activation</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseActivation(Activation object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Activation Mapping</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Activation Mapping</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseActivationMapping(ActivationMapping object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Form</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Form</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseForm(Form object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Link</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Link</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseLink(Link object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Simple Link</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Simple Link</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseSimpleLink(SimpleLink object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Param Link</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Param Link</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseParamLink(ParamLink object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Link Mapping</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Link Mapping</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseLinkMapping(LinkMapping object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Object</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Object</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseObject(TapestryModel.Object object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Entity</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Entity</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseEntity(Entity object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Enum</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Enum</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseEnum(TapestryModel.Enum object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Value</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Value</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseValue(Value object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Data</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Data</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseData(Data object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Entity Data</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Entity Data</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseEntityData(EntityData object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Content Data</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Content Data</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseContentData(ContentData object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Reference</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Reference</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseReference(Reference object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Attribute</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Attribute</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseAttribute(Attribute object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Content Object</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Content Object</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseContentObject(ContentObject object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Content Attirbute</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Content Attirbute</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public T caseContentAttirbute(ContentAttirbute object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch, but this is the last case anyway.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject)
     * @generated
     */
    public T defaultCase(EObject object) {
        return null;
    }

} //TapestryModelSwitch
